<div class="nav">
    <a class="sel" href="{:U('index')}">类别列表</a>
    <a href="{:U('add')}">添加类别</a>
</div>
<div class="search">
    <form id="frm_search" name="frm_search" method="get" action="">
        选择父类：
        <select name="parent_id" id="parent_id"  class="sel1">
            <option value="0">所有类别</option>
            <foreach name="search_list" item="item" >
                <option value="{$item.cat_id}">{$item.cat_name}</option>
            </foreach>
        </select>&nbsp;&nbsp;
    </form>
    <script type="text/javascript">
        $("#parent_id").val("{$parent_id}");
        $("#parent_id").change(function() {
            $("#frm_search").submit();
        });
    </script>
</div>
<div class="list">
    <table class="table_list">
        <thead>
            <tr>
                <td>类别名称</td>
                <td>顺序编号</td>
                <td>是否启用</td>
                <td>导航显示</td>
                <td width="400px">操作</td>
            </tr>
        </thead>
        <tbody>
        <foreach name="list" item="list">
            <tr>
                <td style="text-align: left;">
            <if condition="$list['cat_level'] lt 2">
                <font color="#2f9000"><b>{$list.cat_name}</b></font>
                <elseif condition="$list['cat_level'] lt 3" />
                <font color="#2f96d0"><b>{$list.cat_name}</b></font>
                <else />
                {$list.cat_name}
            </if>
            </td>
            <td class="edit_input" attr_t="order_id" attr_id="{$list.cat_id}">{$list.order_id}</td>
            <td class="edit_toggle" attr_t="is_enable" attr_id="{$list.cat_id}">{$list.is_enable}</td>
            <td class="edit_toggle" attr_t="is_menu" attr_id="{$list.cat_id}">{$list.is_menu}</td>
            <td width="240px" style="text-align:right;padding-right:18px;"><if condition="$list['cat_level'] lt 4">
                <a class="btn_a3" href="{:U('add',Array('parent_id'=>$list['cat_id']))}">添加子分类</a>
            </if>
            <a class="btn_a" href="{:U('edit',Array('cat_id'=>$list['cat_id']))}">修改</a>&nbsp;
            <a class="btn_a2" href="{:U('del',Array('cat_id'=>$list['cat_id']))}" onclick="return confirm('确定删除类别吗？删除前请先删除该类别下的子类或商品')">删除</a></td>
            </tr>
        </foreach>
        </tbody>
        <tfoot>
            <tr><td colspan="5"><div class="page">{$page}</div></td>
            </tr>
        </tfoot>
    </table>
</div>
